#!/bin/bash

# Setup directories
export DEPLOY_DIR="$( cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 ; pwd -P )"
export PROJECT_DIR="${DEPLOY_DIR}/.."
export MODEL_DIR="/path/to/llm/checkpoints/" # where you keep your model checkpoints

# Connections
export FRONTEND_URI="localhost:6001"
export FRONTEND_SERVER_PORT="8090"
export CHAIN_SERVER_HOST="0.0.0.0"
export CHAIN_SERVER_PORT="8081"

# Log levels [optional, default='WARN']
export SDR_LOG_LEVEL='INFO'
export FRONTEND_LOG_LEVEL='WARN'
export CHAIN_LOG_LEVEL='INFO'

# LLM chain settings
export NVIDIA_API_KEY=""
export DB_CHUNK_SIZE=1024
export DB_CHUNK_OVERLAP=128

# NIM settings
# Currently configured to build Mistral 7B (with example config)
export LLM="mistralai/Mistral-7B-Instruct-v0.2" # directory of checkpoint, relative to MODEL_DIR
export MODEL_CHECKPOINT="${MODEL_DIR}/${LLM}"
export NIM_MODEL_PATH="${MODEL_DIR}/nim/${LLM}"
export NIM_CONFIG_FILE="${PROJECT_DIR}/nim/configs/mistral-7b.yaml"
export NIM_OPENAI_PORT=9999

# File replay settings
# If a replay file is provided, the 'file-replay' container will replay a
# .wav audio file as I/Q FM samples transmitted over UDP in real-time, mimicking
# the input from a radio.
export REPLAY_FILE=""  # WAV file to replay. Should be located in file-replay/files.
# export SDR_IP="0.0.0.0"         # [optional] Check sdr-holoscan.params.network_rx.ip_addr
# export SDR_PORT=5005            # [optional] Check sdr-holoscan.params.network_rx.dst_port
# export SDR_MAX_PKT_SZ=1472      # [optional] Check sdr-holoscan.params.network_rx.max_payload_size
# export SDR_SAMPLE_RATE=1000000  # [optional] Check sdr-holoscan.params.sensor.sample_rate
# export REPLAY_TIME=0            # [optional] If non-zero, loops for REPLAY_TIME seconds

# Specify GPUs (Riva by default uses 0)
# export SDR_GPU=0       # [optional, default='all']
# export FRONTEND_GPU=0  # [optional, default='all']
# export CHAIN_GPU=0     # [optional, default='all']
# export REPLAY_GPU=0    # [optional, default='all']
# export NIM_GPU=0       # [optional, default='all']
